package alog;

import java.util.Scanner;

public class n_thread implements Runnable{
    static int jj = 0;
    static int n;
    public static void main(String[] args) {
        n_thread th = new n_thread();
        Scanner sc = new Scanner(System.in);
        n = sc.nextInt();
        for (int i = 0; i < n; i++) {
            new Thread(th, String.valueOf(i)).start();
        }
    }
    @Override
    public void run() {
        while(true){
            synchronized (this){
                notifyAll();
                if(jj >= 100)
                    break;
                int id = Integer.parseInt(Thread.currentThread().getName());
                if(jj % n == id)
                    System.out.println("thread " + id + "-->" + ++jj);
                try {
                    wait();
                } catch (InterruptedException e) {
                    e.printStackTrace();
                }
            }
        }
    }
}
